home *** CD-ROM | disk | FTP | other *** search
/ Network PC / Network PC.iso / amiga utilities / communication / internet / amitcp3.0b / src.lha / src / amitcp / kern / amiga_includes.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-09-08  |  6.2 KB  |  274 lines

  1. /*
  2.  * $Id: amiga_includes.h,v 1.20 1993/06/04 11:16:15 jraja Exp $
  3.  * 
  4.  * Copyright (c) 1993 AmiTCP/IP Group, <amitcp-group@hut.fi>
  5.  *                    Helsinki University of Technology, Finland.
  6.  *                    All rights reserved.
  7.  *
  8.  * HISTORY
  9.  * $Log: amiga_includes.h,v $
  10.  * Revision 1.20  1993/06/04  11:16:15  jraja
  11.  * Fixes for first public release.
  12.  *
  13.  * Revision 1.19  1993/06/03  20:51:30  ppessi
  14.  * Added RCS ID
  15.  *
  16.  * Revision 1.18  93/04/24  22:06:35  22:06:35  jraja (Jarno Tapio Rajahalme)
  17.  * Removed inclusion of machine/ansi.h. Added #define _SIZE_T_ instead.
  18.  * 
  19.  * Revision 1.17  93/04/13  22:26:48  22:26:48  jraja (Jarno Tapio Rajahalme)
  20.  * Removed replacing exec pragmas since it just doesn't work :-(
  21.  * 
  22.  * Revision 1.16  93/04/05  14:58:33  14:58:33  jraja (Jarno Tapio Rajahalme)
  23.  * Added inline Forbid.
  24.  * 
  25.  * Revision 1.15  93/03/22  04:17:42  04:17:42  ppessi (Pekka Pessi)
  26.  * Fixed include headaches, size_t kludge is hopefully dead and buried.
  27.  * However, if you try to compile AmiTCP/IP with SAC SHORTINTS ....
  28.  * 
  29.  * Revision 1.14  93/03/20  18:43:25  18:43:25  ppessi (Pekka Pessi)
  30.  * Added ExecBase
  31.  * and SysBase
  32.  * 
  33.  * Revision 1.12  93/03/17  12:10:42  12:10:42  jraja (Jarno Tapio Rajahalme)
  34.  * Added inline versions of AbortIO() and Remove().
  35.  * 
  36.  * Revision 1.11  93/03/17  09:58:16  09:58:16  jraja (Jarno Tapio Rajahalme)
  37.  * Added inline AbortIO().
  38.  * Changed SAS pragmas to use ioRequest->io_Device directly.
  39.  * 
  40.  * Revision 1.10  93/03/05  12:25:50  12:25:50  jraja (Jarno Tapio Rajahalme)
  41.  * Defined TimerBase as struct Library for GCC, too.
  42.  * 
  43.  * Revision 1.9  93/03/05  10:56:04  10:56:04  jraja (Jarno Tapio Rajahalme)
  44.  * Some changes made by Pekka.
  45.  * 
  46.  * Revision 1.8  93/03/05  03:25:26  03:25:26  ppessi (Pekka Pessi)
  47.  * Compiles with SASC. Initial test version.
  48.  * 
  49.  * Revision 1.7  93/03/04  09:42:22  09:42:22  jraja (Jarno Tapio Rajahalme)
  50.  * Fixed includes.
  51.  * 
  52.  * Revision 1.6  93/03/02  16:54:51  16:54:51  ppessi (Pekka Pessi)
  53.  * Added dos/dos.h (break bit defines)
  54.  * 
  55.  * Revision 1.5  93/02/26  13:22:38  13:22:38  too (Tomi Ollila)
  56.  * code checked w/ too, ppessi and jraja
  57.  * 
  58.  * Revision 1.4  93/02/04  18:33:18  18:33:18  jraja (Jarno Tapio Rajahalme)
  59.  * Added needed include files.
  60.  * 
  61.  * Revision 1.3  93/01/06  19:05:12  19:05:12  jraja (Jarno Tapio Rajahalme)
  62.  * added timer prototypes.
  63.  * 
  64.  * Revision 1.2  92/12/22  00:51:30  00:51:30  jraja (Jarno Tapio Rajahalme)
  65.  * removed inline-keyword hassle (handled in sys/cdefs.h).
  66.  * 
  67.  * Revision 1.1  92/12/22  00:02:08  00:02:08  jraja (Jarno Tapio Rajahalme)
  68.  * Initial revision
  69.  * 
  70.  */
  71. #ifndef AMIGA_INCLUDES_H
  72. #define AMIGA_INCLUDES_H
  73.  
  74. /*
  75.  * Standard Amiga includes
  76.  */
  77. #ifndef EXEC_TYPES_H
  78. #include <exec/types.h>
  79. #endif
  80.  
  81. #ifndef EXEC_LISTS_H
  82. #include <exec/lists.h>
  83. #endif
  84.  
  85. #ifndef EXEC_MEMORY_H
  86. #include <exec/memory.h>
  87. #endif
  88.  
  89. #ifndef EXEC_SEMAPHORES_H
  90. #include <exec/semaphores.h>
  91. #endif
  92.  
  93. #ifndef EXEC_LIBRARIES_H
  94. #include <exec/libraries.h>
  95. #endif
  96.  
  97. #ifndef EXEC_DEVICES_H
  98. #include <exec/devices.h>
  99. #endif
  100.  
  101. #ifndef EXEC_EXECBASE_H
  102. #include <exec/execbase.h>
  103. #endif
  104.  
  105. #ifndef DOS_DOS_H
  106. #include <dos/dos.h>
  107. #endif
  108.  
  109. #ifndef SYS_CDEFS_H
  110. #include <sys/cdefs.h>
  111. #endif
  112.  
  113. #ifndef SYS_TYPES_H
  114. #include <sys/types.h>
  115. #endif
  116.  
  117. #if !defined(SYS_TIME_H)
  118. #include <sys/time.h>
  119. #endif
  120. /*
  121.  * for built in functions in SASC
  122.  */
  123. #if __SASC
  124. #define USE_BUILTIN_MATH
  125. #ifndef _STRING_H
  126. #include <string.h>
  127. #endif
  128. #elif __GNUC__
  129. /* There is also built in functions in GNUC
  130.  * -- however, we do not use them just now.
  131.  */
  132. #define _SIZE_T_        unsigned int            /* sizeof() */
  133.  
  134. #ifdef _SIZE_T_
  135. typedef _SIZE_T_ size_t;
  136. #undef _SIZE_T_
  137. #endif
  138.  
  139. #ifndef NULL
  140. #define NULL 0
  141. #endif
  142.  
  143. #endif
  144.  
  145. extern struct ExecBase *SysBase;
  146. /*
  147.  * Amiga shared library prototypes
  148.  */
  149.  
  150. #if __GNUC__
  151.  
  152. #ifndef _INLINE_EXEC_H
  153. #define Remove garbageRemove    /* we have inline version */
  154. #define Forbid garbageForbid    /* we have inline version */
  155. #define AbortIO garbageAbortIO    /* we have inline version */
  156. #define NewList garbageNewList    /* conflicts with amiga.lib */
  157. #include <inline/exec.h>
  158. #undef NewList
  159. #undef AbortIO
  160. #undef Forbid
  161. #undef Remove
  162. #endif
  163.  
  164. #ifndef _INLINE_TIMER_H
  165. /*
  166.  * predefine TimerBase to Library to follow SASC convention.
  167.  */
  168. #define BASE_EXT_DECL extern struct Library * TimerBase;
  169. #define BASE_NAME (struct Device *)TimerBase
  170. #include <inline/timer.h>
  171. #endif
  172.  
  173. static inline VOID  
  174. BeginIO(register struct IORequest *ioRequest)
  175. {
  176.   register struct IORequest *a1 __asm("a1") = ioRequest;
  177.   register struct Device *a6 __asm("a6") = ioRequest->io_Device;
  178.   __asm __volatile ("jsr a6@(-0x1e)"
  179.   : /* no output */
  180.   : "r" (a6), "r" (a1)
  181.   : "a0","a1","d0","d1", "memory");
  182. }
  183.  
  184. static inline VOID  
  185. AbortIO(register struct IORequest *ioRequest)
  186. {
  187.   register struct IORequest *a1 __asm("a1") = ioRequest;
  188.   register struct Device *a6 __asm("a6") = ioRequest->io_Device;
  189.   __asm __volatile ("jsr a6@(-0x24)"
  190.   : /* no output */
  191.   : "r" (a6), "r" (a1)
  192.   : "a0","a1","d0","d1", "memory");
  193. }
  194.  
  195. static inline VOID 
  196. Remove(register struct Node *node)
  197. {
  198.   register struct Node *node2;
  199.  
  200.   node2 = node->ln_Succ;
  201.   node = node->ln_Pred;
  202.   node->ln_Succ = node2;
  203.   node2->ln_Pred = node;
  204. }
  205.  
  206. static inline VOID
  207. Forbid(void)
  208. {
  209.   SysBase->TDNestCnt++;
  210. }
  211.  
  212. #elif __SASC
  213.  
  214. #ifndef CLIB_EXEC_PROTOS_H
  215. #include <clib/exec_protos.h>
  216. #endif
  217. #include <pragmas/exec_sysbase_pragmas.h>
  218. #ifndef PROTO_TIMER_H
  219. #include <proto/timer.h>
  220. #endif
  221.  
  222. #pragma msg 93 ignore push
  223.  
  224. #if 0
  225.  
  226. extern VOID pragmaed_AbortIO(struct IORequest *);
  227. #pragma libcall DeviceBase pragmaed_AbortIO 24 901
  228.  
  229. static inline __asm VOID 
  230. AbortIO(register __a1 struct IORequest *ioRequest)
  231. {
  232. #define DeviceBase ioRequest->io_Device
  233.   pragmaed_AbortIO(ioRequest);
  234. #undef DeviceBase
  235. }
  236.  
  237. #endif
  238.  
  239. extern VOID pragmaed_BeginIO(struct IORequest *);
  240. #pragma libcall DeviceBase pragmaed_BeginIO 1E 901
  241.  
  242. static inline __asm VOID 
  243. BeginIO(register __a1 struct IORequest *ioRequest)
  244. {
  245. #define DeviceBase ioRequest->io_Device
  246.   pragmaed_BeginIO(ioRequest);
  247. #undef DeviceBase
  248. }
  249.  
  250. #pragma msg 93 pop
  251.  
  252. #endif
  253.  
  254.  
  255. /*
  256.  * common inlines for both compilers
  257.  */
  258.  
  259. static inline VOID
  260. NewList(register struct List *list)
  261. {
  262.   list->lh_Head = (struct Node *)&list->lh_Tail;
  263.   list->lh_Tail = NULL;
  264.   list->lh_TailPred = (struct Node *)list;
  265. }
  266.  
  267. /*
  268.  * undef math log, because it conflicts with log() used for logging.
  269.  */
  270. #undef log
  271.  
  272. #endif /* !AMIGA_INCLUDES_H */
  273.  
  274.